package com.java.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

/**
 * 订单信息
 * @author Administrator
 *
 */
@Entity
@org.hibernate.annotations.Entity(
		selectBeforeUpdate = true, 
		dynamicInsert = true, 
		dynamicUpdate = true
)
@Table(name="order_form")
public class OrderForm implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3949494294544269968L;

	@Id
	@GeneratedValue
	private Long id;
	
	/**
	 * 合同号
	 */
	@Column(length=20)
	private String orderCode;
	
	/**
	 * 所属业务员用户
	 */
	@ManyToOne
	@NotFound(action=NotFoundAction.IGNORE)
	private User user;
	
	/**
	 * 工厂付款情况
	 */
	@OneToMany(mappedBy="order",fetch=FetchType.LAZY,cascade=CascadeType.REMOVE)
	private List<FactoryPayment> factoryList = new ArrayList<FactoryPayment>();
	
	/**
	 * 收入支出情况
	 */
	@OneToMany(mappedBy="order",fetch=FetchType.LAZY,cascade=CascadeType.REMOVE)
	private List<IncomeExpenses> incomeList = new ArrayList<IncomeExpenses>();
	
	/**
	 * 客户国家
	 */
	@Column(length=100)
	private String customerCountry;
		
	/**
	 * 客户公司
	 */
	@Column(length=100)
	private String customerCompany;
	
	/**
	 * 客户名字
	 */
	@Column(length=100)
	private String customerName;
	
	/**
	 * 客户等级
	 */
	@ManyToOne
	@JoinColumn(name="grade",referencedColumnName="id")
	@NotFound(action=NotFoundAction.IGNORE)
	private Code customerGrade;
	
	/**
	 * 总金额
	 */
	@Column(nullable=true)
	private Double totalAmount=0d;

	/**
	 * 总件数
	 */
	@Column(nullable=true)
	private Integer totalNumber=0;

	/**
	 * 总毛重
	 */
	@Column(nullable=true)
	private Integer grossWeight=0;
	
	/**
	 * 总体积
	 */
	@Column(nullable=true)
	private Integer totatlVolume=0;
	
	/**
	 * 价格术语
	 */
	@Column(length=30)
	private String priceTerms;
	
	/**
	 * 成交日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date closingDate;
	
	/**
	 * 出货港口
	 */
	@Column(length=100)
	private String startShipment;
	
	/**
	 * 运抵港口
	 */
	@Column(length=100)
	private String endShipment;
	
	/**
	 * 成交方式
	 */
	@Column(length=20)
	private String transactionMethod;
	
	/**
	 * 出货日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date dateShipment;
	
	/**
	 * 订单状态
	 */
	@ManyToOne(optional=true)
	@JoinColumn(name="status",referencedColumnName="id")
	@NotFound(action=NotFoundAction.IGNORE)
	private Code status;
		
	/**
	 * 订单打分
	 */
	@Column(nullable=true)
	private Integer scoring;
	
	/**
	 * 备注
	 */
	@Column(length=200)
	private String detail1;
	
	/**
	 * 客户第1次付款
	 */
	@Column(nullable=true)
	private Double paymentAmount1=0d;
	
	/**
	 * 银行费用
	 */
	@Column(nullable=true)
	private Double bankCharges1=0d;
	
	/**
	 * 实际收入
	 */
	@Column(nullable=true)
	private Double realIncome1=0d;
	
	/**
	 * 结汇收入
	 */
	@Column(nullable=true)
	private Double exchangeIncome1=0d;
	
	/**
	 * 客户收款账户
	 */
	@Column(length=200)
	private String customerAccount1;
	
	/**
	 * 客户第1次付款日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date paymentTime1;
	
	/**
	 * 客户第2次付款
	 */
	@Column(nullable=true)
	private Double paymentAmount2=0d;
	
	/**
	 * 银行费用
	 */
	@Column(nullable=true)
	private Double bankCharges2=0d;
	
	/**
	 * 实际收入
	 */
	@Column(nullable=true)
	private Double realIncome2=0d;
	
	/**
	 * 结汇收入
	 */
	@Column(nullable=true)
	private Double exchangeIncome2=0d;
	
	/**
	 * 客户收款账户
	 */
	@Column(length=200)
	private String customerAccount2;
	
	/**
	 * 客户第1次付款日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date paymentTime2;
	
	/**
	 * 客户第3次付款
	 */
	@Column(nullable=true)
	private Double paymentAmount3=0d;
	
	/**
	 * 银行费用
	 */
	@Column(nullable=true)
	private Double bankCharges3=0d;
	
	/**
	 * 实际收入
	 */
	@Column(nullable=true)
	private Double realIncome3=0d;
	
	/**
	 * 结汇收入
	 */
	@Column(nullable=true)
	private Double exchangeIncome3=0d;
	
	/**
	 * 客户收款账户
	 */
	@Column(length=200)
	private String customerAccount3;
	
	/**
	 * 客户第1次付款日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date paymentTime3;
	
	/**
	 * 客户第4次付款
	 */
	@Column(nullable=true)
	private Double paymentAmount4=0d;
	
	/**
	 * 银行费用
	 */
	@Column(nullable=true)
	private Double bankCharges4=0d;
	
	/**
	 * 实际收入
	 */
	@Column(nullable=true)
	private Double realIncome4=0d;
	
	/**
	 * 结汇收入
	 */
	@Column(nullable=true)
	private Double exchangeIncome4=0d;
	
	/**
	 * 客户收款账户
	 */
	@Column(length=200)
	private String customerAccount4;
	
	/**
	 * 客户第1次付款日期
	 */
	@Temporal(TemporalType.TIMESTAMP)	
	private Date paymentTime4;
	
	/**
	 * 备注
	 */
	@Column(length=200)
	private String detail2;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Code getStatus() {
		return status;
	}

	public void setStatus(Code status) {
		this.status = status;
	}

	public String getCustomerCountry() {
		return customerCountry;
	}

	public void setCustomerCountry(String customerCountry) {
		this.customerCountry = customerCountry;
	}

	public String getCustomerCompany() {
		return customerCompany;
	}

	public void setCustomerCompany(String customerCompany) {
		this.customerCompany = customerCompany;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Code getCustomerGrade() {
		return customerGrade;
	}

	public void setCustomerGrade(Code customerGrade) {
		this.customerGrade = customerGrade;
	}

	public Double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	public Integer getTotalNumber() {
		return totalNumber;
	}

	public void setTotalNumber(Integer totalNumber) {
		this.totalNumber = totalNumber;
	}

	public Integer getGrossWeight() {
		return grossWeight;
	}

	public void setGrossWeight(Integer grossWeight) {
		this.grossWeight = grossWeight;
	}

	public Integer getTotatlVolume() {
		return totatlVolume;
	}

	public void setTotatlVolume(Integer totatlVolume) {
		this.totatlVolume = totatlVolume;
	}

	public String getPriceTerms() {
		return priceTerms;
	}

	public void setPriceTerms(String priceTerms) {
		this.priceTerms = priceTerms;
	}

	public Date getClosingDate() {
		return closingDate;
	}

	public void setClosingDate(Date closingDate) {
		this.closingDate = closingDate;
	}

	public String getStartShipment() {
		return startShipment;
	}

	public void setStartShipment(String startShipment) {
		this.startShipment = startShipment;
	}

	public String getEndShipment() {
		return endShipment;
	}

	public void setEndShipment(String endShipment) {
		this.endShipment = endShipment;
	}

	public String getTransactionMethod() {
		return transactionMethod;
	}

	public void setTransactionMethod(String transactionMethod) {
		this.transactionMethod = transactionMethod;
	}

	public Date getDateShipment() {
		return dateShipment;
	}

	public void setDateShipment(Date dateShipment) {
		this.dateShipment = dateShipment;
	}

	public Integer getScoring() {
		return scoring;
	}

	public void setScoring(Integer scoring) {
		this.scoring = scoring;
	}

	public String getDetail1() {
		return detail1;
	}

	public void setDetail1(String detail1) {
		this.detail1 = detail1;
	}

	public Double getPaymentAmount1() {
		return paymentAmount1;
	}

	public void setPaymentAmount1(Double paymentAmount1) {
		this.paymentAmount1 = paymentAmount1;
	}

	public Double getBankCharges1() {
		return bankCharges1;
	}

	public void setBankCharges1(Double bankCharges1) {
		this.bankCharges1 = bankCharges1;
	}

	public Double getRealIncome1() {
		return realIncome1;
	}

	public void setRealIncome1(Double realIncome1) {
		this.realIncome1 = realIncome1;
	}

	public Double getExchangeIncome1() {
		return exchangeIncome1;
	}

	public void setExchangeIncome1(Double exchangeIncome1) {
		this.exchangeIncome1 = exchangeIncome1;
	}

	public String getCustomerAccount1() {
		return customerAccount1;
	}

	public void setCustomerAccount1(String customerAccount1) {
		this.customerAccount1 = customerAccount1;
	}

	public Date getPaymentTime1() {
		return paymentTime1;
	}

	public void setPaymentTime1(Date paymentTime1) {
		this.paymentTime1 = paymentTime1;
	}

	public Double getPaymentAmount2() {
		return paymentAmount2;
	}

	public void setPaymentAmount2(Double paymentAmount2) {
		this.paymentAmount2 = paymentAmount2;
	}

	public Double getBankCharges2() {
		return bankCharges2;
	}

	public void setBankCharges2(Double bankCharges2) {
		this.bankCharges2 = bankCharges2;
	}

	public Double getRealIncome2() {
		return realIncome2;
	}

	public void setRealIncome2(Double realIncome2) {
		this.realIncome2 = realIncome2;
	}

	public Double getExchangeIncome2() {
		return exchangeIncome2;
	}

	public void setExchangeIncome2(Double exchangeIncome2) {
		this.exchangeIncome2 = exchangeIncome2;
	}

	public String getCustomerAccount2() {
		return customerAccount2;
	}

	public void setCustomerAccount2(String customerAccount2) {
		this.customerAccount2 = customerAccount2;
	}

	public Date getPaymentTime2() {
		return paymentTime2;
	}

	public void setPaymentTime2(Date paymentTime2) {
		this.paymentTime2 = paymentTime2;
	}

	public Double getPaymentAmount3() {
		return paymentAmount3;
	}

	public void setPaymentAmount3(Double paymentAmount3) {
		this.paymentAmount3 = paymentAmount3;
	}

	public Double getBankCharges3() {
		return bankCharges3;
	}

	public void setBankCharges3(Double bankCharges3) {
		this.bankCharges3 = bankCharges3;
	}

	public Double getRealIncome3() {
		return realIncome3;
	}

	public void setRealIncome3(Double realIncome3) {
		this.realIncome3 = realIncome3;
	}

	public Double getExchangeIncome3() {
		return exchangeIncome3;
	}

	public void setExchangeIncome3(Double exchangeIncome3) {
		this.exchangeIncome3 = exchangeIncome3;
	}

	public String getCustomerAccount3() {
		return customerAccount3;
	}

	public void setCustomerAccount3(String customerAccount3) {
		this.customerAccount3 = customerAccount3;
	}

	public Date getPaymentTime3() {
		return paymentTime3;
	}

	public void setPaymentTime3(Date paymentTime3) {
		this.paymentTime3 = paymentTime3;
	}

	public Double getPaymentAmount4() {
		return paymentAmount4;
	}

	public void setPaymentAmount4(Double paymentAmount4) {
		this.paymentAmount4 = paymentAmount4;
	}

	public Double getBankCharges4() {
		return bankCharges4;
	}

	public void setBankCharges4(Double bankCharges4) {
		this.bankCharges4 = bankCharges4;
	}

	public Double getRealIncome4() {
		return realIncome4;
	}

	public void setRealIncome4(Double realIncome4) {
		this.realIncome4 = realIncome4;
	}

	public Double getExchangeIncome4() {
		return exchangeIncome4;
	}

	public void setExchangeIncome4(Double exchangeIncome4) {
		this.exchangeIncome4 = exchangeIncome4;
	}

	public String getCustomerAccount4() {
		return customerAccount4;
	}

	public void setCustomerAccount4(String customerAccount4) {
		this.customerAccount4 = customerAccount4;
	}

	public Date getPaymentTime4() {
		return paymentTime4;
	}

	public void setPaymentTime4(Date paymentTime4) {
		this.paymentTime4 = paymentTime4;
	}

	public String getDetail2() {
		return detail2;
	}

	public void setDetail2(String detail2) {
		this.detail2 = detail2;
	}

	public List<FactoryPayment> getFactoryList() {
		return factoryList;
	}

	public void setFactoryList(List<FactoryPayment> factoryList) {
		this.factoryList = factoryList;
	}

	public List<IncomeExpenses> getIncomeList() {
		return incomeList;
	}

	public void setIncomeList(List<IncomeExpenses> incomeList) {
		this.incomeList = incomeList;
	}

	
}
